# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :send_code.py
# @Time      :2022/5/27 0027 20:35
# @Author    :何胜利
import json

from ronglian_sms_sdk import SmsSDK
from common.celery_tasks.main import app


@app.task
def sms_code(mobile, code, expire=5):
    sdk = SmsSDK(
        accId="8a216da8804ba8a5018064a2f6770685",
        accToken="6ee0ec3216db4cc0acfdd3764827fbc2",
        appId="8a216da8804ba8a5018064a2f7fc068c",
    )

    # 组织数据
    tid = "1"
    mobile = "%s" % mobile
    datas = ("%s" % code, "%s" % expire)
    res = sdk.sendMessage(tid, mobile, datas)
    # print("容联云的res>>>", res)
    # print("容联云的res111>>>", json.loads(res))
    return json.loads(res)

